package com.example.modelsystem.dao;

import com.example.modelsystem.entity.ContactEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

@Mapper
@Repository
public interface ContactMapper {

    @Select("SELECT t1.id, t2.id AS contact_id, t2.username AS contact_username, t2.icon AS contact_icon, t2.email AS contact_email, t2.nick_name AS contact_nick_name " +
            "FROM contact t1 LEFT JOIN sys_user t2 ON t1.contact_id = t2.id WHERE user_id  = #{userId}")
    List<ContactEntity> selectByUserId(@Param("userId") Integer userId);


}